package com.cap.bts.crmdp.dealer.purchase.domain;

import java.io.Serializable;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import com.cap.bts.crmdp.dealer.card.domain.CardDefinition;
import com.cap.bts.framework.common.domain.BaseDomain;


/**
 * The persistent class for the TM_CARD_INVENTORY database table.
 * 
 */
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@Entity
@Table(name="TM_CARD_INVENTORY")
@AttributeOverrides({
    @AttributeOverride(name="createBy", column=@Column(name="CREATE_BY")),
    @AttributeOverride(name="createDate", column=@Column(name="CREATE_DATE", nullable = false)),
    @AttributeOverride(name="lastUpdateBy", column=@Column(name="LAST_UPDATE_BY")),
    @AttributeOverride(name="lastUpdateDate", column=@Column(name="LAST_UPDATE_DATE"))
})
public class CardInventory extends BaseDomain implements Serializable {

    /**
     * 
     */
    private static final long serialVersionUID = 7280766170625967374L;

    private Long id;

    private Long dealerId;

    private Integer onhandQuantity;

    private CardDefinition cardDefinition;


    @Id
    @GeneratedValue(strategy=GenerationType.AUTO)
    public Long getId() {
        return this.id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Column(name="DEALER_ID")
    public Long getDealerId() {
        return this.dealerId;
    }

    public void setDealerId(Long dealerId) {
        this.dealerId = dealerId;
    }

    @Column(name="ONHAND_QUANTITY")
    public Integer getOnhandQuantity() {
        return this.onhandQuantity;
    }

    public void setOnhandQuantity(Integer onhandQuantity) {
        this.onhandQuantity = onhandQuantity;
    }

      /**
     * @Date        :      Aug 19, 2015
     *
     * @return the cardDefinition
     */
    @ManyToOne(optional = false, targetEntity = CardDefinition.class,fetch = FetchType.LAZY)
    @JoinColumn(name = "CARD_DEF_ID", referencedColumnName = "ID")
    public CardDefinition getCardDefinition() {
        return cardDefinition;
    }

    /**
     * @Date        :      Aug 19, 2015
     *
     * @param cardDefinition the cardDefinition to set
     */
    public void setCardDefinition(CardDefinition cardDefinition) {
        this.cardDefinition = cardDefinition;
    }

}